﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Text.RegularExpressions;
namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            a5();
        }
        static void a1()
        {
            Random ran = new Random();
            for (int i = 0; i < 10; i++)
            {
                double a = ran.NextDouble() * 5;
                string b = (a.ToString("f2"));
                Console.WriteLine(b);
            }

        }
        static void a2()
        {
            Random ran = new Random();
            
            for (int i = 0; i < 10; i++)
            {
                double a = ran.NextDouble() * (7-4)+4;
                string b = (a.ToString("f2"));
                Console.WriteLine(b);
            }
        }
        static void a3()
        {
            Random ran = new Random();
            int[] arr=new int[10];
            int a = ran.Next(10);
            for (int i = 0; i < arr.Length; i++)
            {
                arr[i] = -1;
            }
            for (int i = 0; i < arr.Length;)
            {
                a = ran.Next(10);
                if (Array.IndexOf(arr,a)==-1)
                {
                    arr[i] = a;
                    i++;
                }
            }

            
            foreach (var item in arr)
            {
                Console.Write(item+" ");
            }
        }

        static void a4()
        {

            for (; ; )
            {
                Console.WriteLine("邮箱");
                string str = Console.ReadLine();
                if (Regex.IsMatch(str, @"^(\w+)(\.*)(\w*)@(\w+)(\.)(com|org|net|edu|mil|tv|biz|info)$"))
                {
                    Console.WriteLine("正确");
                }
                else
                {
                    Console.WriteLine("错误");
                }
            }

        }
        static void a5()
        {
            for (; ; )
            {
                Console.WriteLine("电话");
                string str = Console.ReadLine();
                if (Regex.IsMatch(str, @"^((\+86)?(13)\d{1}|(14)(5|7)|((15)([0-3]{1}|[5-9]{1}))|((17)([6-8]{1})|(18\d{1})))\d{8}$"))
                {
                    Console.WriteLine("正确");
                }
                else
                {
                    Console.WriteLine("错误");
                }
            }
        }
    }
}
